import DefaultPage from "@/pages/DefaultPage.vue";
import ErrorPage from "@/pages/ErrorPage.vue";
import StylePage from "@/pages/StylePage.vue";
import BuildPage from "@/pages/BuildPage.vue";
import CompositionPage from "@/pages/CompositionPage.vue";
import CompositionPage2 from "@/pages/CompositionPage2.vue";
import CompositionPage3 from "@/pages/CompositionPage3.vue";
import CompositionCart from "@/pages/CompositionCart.vue";
import AjaxPage from "@/pages/AjaxPage.vue";
import RouterPage from "@/pages/RouterPages/RouterPage.vue";
import RouterChildOne from "@/pages/RouterPages/views/RouterChildOne.vue";
import RouterChildTwo from "@/pages/RouterPages/views/RouterChildTwo.vue";
import RouterConfig from "@/pages/RouterPages/RouterConfig.vue";
import NotFound from "@/pages/NotFound.vue";



const routes = [
    // path 地址定义
    //      path 地址定义规则是 参考 服务器路径地址规则的
    //          + 一级路由地址必须以 / 方式描述，表示该路径为vue路由的最顶层地址路径
    //          + 其它级别的地址可以使用 以/开头的绝对地址模式，或者不以/开头的相对地址模式
    //                  - 以/开头的绝对地址模式 => 子路由提供独立的导航地址，访问该地址时 类似于从服务器根目录中加载该组件
    //                  - 不以/开头的相对地址模式 => 子路由只提供自己的相对URL地址，访问该地址时，必须先访问父路由地址
    // component 该地址对应的组件
    // { path:"/",component:DefaultPage },
    { path:"/",redirect:"/default" },
    { path:"/default",component:DefaultPage },
    { path:"/error",component:ErrorPage },
    { path:"/style",component:StylePage },
    { path:"/build",component:BuildPage },
    { path:"/compos1",component:CompositionPage },
    { path:"/compos2",component:CompositionPage2 },
    { path:"/compos3",component:CompositionPage3 },
    { path:"/cart",component:CompositionCart },
    { path:"/ajax",component:AjaxPage },
    { 
        path:"/router",component:RouterPage,
        // 通过 children 属性完成子路由的定义
        // children:取值等同于 createRouter 配置选项的 routes 取值
        children:[
            // { path:"",component:RouterChildOne },
            { path:"",redirect:"/router/one" },

            // { path:"/router/one",component:RouterChildOne },
            // { path:"/router/two",component:RouterChildTwo }
            // { path:"/router/:a(.*)*",component:NotFound }

            // { path:"/one",component:RouterChildOne },
            // { path:"/two",component:RouterChildTwo },
            // { path:"/:a(.*)*",component:NotFound }

            { path:"one",component:RouterChildOne },
            { path:"two",component:RouterChildTwo },
            { path:":a(.*)*",component:NotFound }
        ]
    },
    // { path:"/router/one",component:RouterChildOne },
    // { path:"/router/two",component:RouterChildTwo },
    { path:"/config",component:RouterConfig },
    { path:"/:a(.*)*",component:NotFound }
]

export default routes;